#ifndef MOVETABLEVIEW_H
#define MOVETABLEVIEW_H

#include <QTableView>
#include <QTime>
#include <QHeaderView>

class TTableView : public QTableView
{
    Q_OBJECT
public:
    explicit TTableView(QWidget *parent = 0);
    //void mouseMoveEvent(QMouseEvent *event);
    void mousePressEvent(QMouseEvent *event);
    void mouseReleaseEvent(QMouseEvent *event);

    void showEvent(QShowEvent *e);
    bool isOnBottom();
    bool isOnTop();

    int pages();
    int currentPage();
    void setScrollVaild(bool);
    //void paintEvent(QPaintEvent *e);
    void setPerPageRow(int n);
    QModelIndexList selectedIndexes() const;
    void setHHeadResizeMode(QHeaderView::ResizeMode mode);

signals:
    void longPressed(const QModelIndex &index);
    void shortPressed(const QModelIndex &index);
    void pageChanged(int currpage,int pages);
public slots:
    void longPress();
    void pageUp();
    void pageDown();
    void onPageChanged(int value);

private:
    //void timerEvent(QTimerEvent *event);
    QScrollBar *mBar;
    int mPressPosY;
    bool mScrollValid;
    bool canLongPress;

    int mScrollValue;
    int mOffsetY;
    int mPerPageRow;
    QMouseEvent *mEvent;

};

#endif // MOVETABLEVIEW_H
